package com.dhz.common.redis;

import java.io.Serializable;

/**
 * 存储到redis的数据对象
 */
public class RedisObject implements Serializable {
    /** Region Name */
    private String region;
    /** Redis Key */
    private String key;
    /** Serializable value */
    private Object value;
    /** 失效时间,单位为毫秒 */
    private int expire;

    public RedisObject(){}

    public RedisObject(String region, String key, Object value, int expire) {
        this.region = region;
        this.key = key;
        this.value = value;
        this.expire = expire;
    }

    public static RedisObject create(String region, String key, Object value, int expire) {
        return new RedisObject(region, key, value, expire);
    }

    public static RedisObject create(String region, String key, Object value) {
        return new RedisObject(region, key, value, 0);
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public int getExpire() {
        return expire;
    }

    public void setExpire(int expire) {
        this.expire = expire;
    }
}
